import unittest
from ChessBoard import *

pawns =  ((0,6), (1,6), (2,6), (3,6), (4,6), (5,6), (6,6), (7,6))

class testMovePawn(unittest.TestCase):
    def setUp(self):
        self.chessboard = ChessBoard()
        self.chessboard.resetBoard()

    def testMoveUpperPawnsByOne(self):
        for x in pawns:
            self.assertTrue(self.chessboard.movePawn(x,self.chessboard.getValidMoves(x)[0]))
        self.chessboard.printBoard()

    def testMoveUpperPawnsByTwo(self):
        for x in pawns:
            self.assertTrue(self.chessboard.movePawn(x,self.chessboard.getValidMoves(x)[1]))
        self.chessboard.printBoard()

    def testNegativeDirectionMove(self):
        for x in pawns:
            self.assertFalse(self.chessboard.movePawn(x,(-1,-1)))

    def testNegativeTargetPositionMove(self):
        for x in pawns:
            self.assertFalse(self.chessboard.movePawn((-1,-1),self.chessboard.getValidMoves(x)[1]))

    def tearDown(self):
        self.chessboard = None

if __name__ == "__main__":
    unittest.main()

